package com.heima.gametest;

public class Test {

    public static void main(String[] args) {
        //定义第一个角色
        Gamer gamer1 = new Gamer("牛", 100);

        //定义第二个角色
        Gamer gamer2 = new Gamer("羊", 100);

        //3.开始决斗，回合制游戏
        while (true) {
            //gamer1攻击gamer2
            gamer1.attack(gamer2);
            if (gamer2.getBlood() == 0) {
                System.out.println(gamer1.getName() + "KO了" + gamer2.getName());
                break;
            }//gamer2攻击gamer1
            gamer2.attack(gamer1);
            if (gamer1.getBlood() == 0) {
                System.out.println(gamer2.getName() + "KO了" + gamer1.getName());
                break;
            }
        }
    }

}
